package cn.jw.starter.gatewayweb;

import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

import cn.jw.starter.gatewayweb.common.JwWebGatewayConfig;
import cn.jw.starter.gatewayweb.filter.AccessAuthVerifyGlobalFilter;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;

/**
 * web 网关的自动化配置类
 *
 * @author 王广帅
 * @since 2024/4/2 1:11
 */
@Slf4j
@AutoConfiguration
@Import(JwWebGatewayConfig.class)
public class JwGatewayWebAutoConfiguration {

    @PostConstruct
    public void init() {
        log.info("初始化网关框架配置成功");
    }

    @Bean
    @ConditionalOnMissingBean
    public AccessAuthVerifyGlobalFilter accessAuthVerifyGlobalFilter() {
        return new AccessAuthVerifyGlobalFilter();
    }
}
